<template>
    <div class="userinfo">
        <dl>
            <dt>
                <router-link to="/user"><a-avatar icon="user" /></router-link>
            </dt>
            <dd>{{userInfo.organName}}</dd>
            <dd>{{userInfo.realName}}</dd>
            <dd>
                <a href="javascript:;" style="color:#222" @click="logout">退出</a>
            </dd>
        </dl>
    </div>
</template>

<script>
import { delCookie, delSessionItem } from './../until/tools'
export default {
    computed: {        
        userInfo() {
            return this.$store.getters.getUserInfo;
        }
    },
    methods:{
        logout() {
            var that = this;
            this.$confirm({
                title: '提示',
                content: '您确定要退出吗？',
                okText: '确定',
                cancelText: '取消',
                centered:true,
                onOk() {
                    delCookie('bd_sid');
                    delCookie('canInput');
                    delSessionItem('dims');
                    that.$router.push('/login');
                }
            })
        }
    }
}
</script>